using System;
using System.Collections;
using System.Web.Mvc;

using Pronghorn.Core;

namespace TestDoubles
{
	public class StubContainer : IIocContainer
	{
		public void AddComponent<T>(string serviceName)
		{
			throw new NotImplementedException();
		}

		public void AddComponent(string serviceName, Type interfaceType, Type implementation)
		{
			throw new NotImplementedException();
		}

		public void Release(IController controller)
		{
			throw new NotImplementedException();
		}

		public T Resolve<T>(string name, Hashtable hashtable)
		{
			throw new NotImplementedException();
		}

		public T Resolve<T>()
		{
			if (typeof(T) == typeof(IFileMinifier))
			{
				return (T)Activator.CreateInstance(typeof(SimpleFileMinifier));
			}
			return default(T);
		}

		public T Resolve<T>(string serviceName)
		{
			if (serviceName == "lib")
			{
				return (T) Activator.CreateInstance(typeof (StubLibraryFileContext));
			}
			if (serviceName == "skin")
			{
				return (T)Activator.CreateInstance(typeof(StubSkinFileContext));
			}
			if (typeof(T) == typeof(IFileLocator) && serviceName == "jsFileLocator")
			{
				return (T)Activator.CreateInstance(typeof(ConventionJsFileLocator));
			}
			if (typeof(T) == typeof(IFileLocator) && serviceName == "cssFileLocator")
			{
				return (T)Activator.CreateInstance(typeof(ConventionCssFileLocator));
			}
			return default(T);
		}
	}
}